package it.terry.smsmock;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.telephony.SmsManager;


public class MockProvider extends Thread{
	
	private Context ctx;
	private SmsManager sms;
	private String SENT = "SMS_SENT";
    private String DELIVERED = "SMS_DELIVERED";
    private PendingIntent sentPI;
    private PendingIntent deliveredPI;
	
	
	
	
	public MockProvider(SmsManager sms,Context ctx){
		
		this.sms=sms;
		this.ctx=ctx;
		
		}

	
	@Override
    public void run() {
    	//rimane in attesa di inviare
		sentPI = PendingIntent.getBroadcast(ctx, 0, new Intent(SENT), 0);
	    deliveredPI = PendingIntent.getBroadcast(ctx, 0, new Intent(DELIVERED), 0);    
	
		}
	public void invia_messaggio(String PHNUM, String MEX){
		
		sms.sendTextMessage(PHNUM, null,MEX, sentPI, deliveredPI);
	}
}
